#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TqSdk Trader 安装脚本
"""

from setuptools import setup, find_packages
from pathlib import Path

# 读取README文件
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text(encoding='utf-8')

# 读取版本信息
def get_version():
    """获取版本信息"""
    version_file = this_directory / "__init__.py"
    if version_file.exists():
        with open(version_file, 'r', encoding='utf-8') as f:
            for line in f:
                if line.startswith('__version__'):
                    return line.split('=')[1].strip().strip('"\'')

    return "1.0.0"

setup(
    name="tqsdk-trader",
    version=get_version(),
    author="TqSdk Trader Team",
    author_email="",
    description="稳健优雅的量化交易框架",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/your-repo/tqsdk-trader",
    packages=find_packages(),
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: Financial and Insurance Industry",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Topic :: Office/Business :: Financial :: Investment",
    ],
    python_requires=">=3.7",
    install_requires=[
        "tqsdk>=3.0.0",
        "numpy>=1.19.0",
        "pandas>=1.3.0",
        "pyyaml>=5.4.0",
        "aiofiles>=0.7.0",
        "requests>=2.25.0",
        "websockets>=8.1",
    ],
    extras_require={
        "dev": [
            "pytest>=6.2.0",
            "pytest-asyncio>=0.15.0",
            "black>=21.0.0",
            "mypy>=0.800",
            "flake8>=3.9.0",
        ],
        "web": [
            "fastapi>=0.68.0",
            "uvicorn>=0.15.0",
            "jinja2>=3.0.0",
        ],
        "monitoring": [
            "psutil>=5.8.0",
            "sentry-sdk>=1.0.0",
        ],
        "visualization": [
            "matplotlib>=3.4.0",
            "seaborn>=0.11.0",
            "plotly>=4.14.0",
        ],
        "database": [
            "sqlalchemy>=1.4.0",
            "alembic>=1.6.0",
        ],
    },
    entry_points={
        "console_scripts": [
            "tqsdk-trader=main:run_trader",
        ],
    },
    include_package_data=True,
    package_data={
        "": ["*.yaml", "*.yml", "*.json"],
    },
    keywords="quantitative trading tqsdk futures options strategy",
    project_urls={
        "Bug Reports": "https://github.com/your-repo/tqsdk-trader/issues",
        "Source": "https://github.com/your-repo/tqsdk-trader",
        "Documentation": "https://tqsdk-trader.readthedocs.io/",
    },
)
